<!--_meta 作为公共模版分离出去-->
<#include "include/_meta.html">
<!--/meta 作为公共模版分离出去-->

<title> 车辆管理-添加保险记录</title>
<meta name="keywords" content="汽车租赁">
<meta name="description" content="H-ui.admin v2.3，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<article class="page-container">
    <form class="form form-horizontal" id="form-insurance-edit">



        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>车牌号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="车牌号"
                       value="${(result.entityObj.carIdCard)}" id="carIdCard" name="carIdCard">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>保险公司：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text"
                       value="${(result.entityObj.company)}" placeholder="保险公司" id="company" name="company">
            </div>
        </div>


        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>出险电话：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${(result.entityObj.companyPhone)}" placeholder="出险电话"
                       id="companyPhone" name="companyPhone">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>保险编号</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${(result.entityObj.code)}" placeholder="保险编号" id="code"
                       name="code">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>保险内容</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="${(result.entityObj.codeContent)}"
                       placeholder="保险内容" id="codeContent" name="codeContent">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>保险费用</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="${(result.entityObj.money)}"
                       placeholder="保险费用" id="money" name="money">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>生效日期</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text Wdate"
                       onfocus="WdatePicker({skin:'whyGreen',startDate:'%y-%M-%d %H:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                       autocomplete="off" value="${(result.entityObj.carInsuranceStart)}" placeholder="生效日期"
                       id="carInsuranceStart" name="carInsuranceStart">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>失效日期</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text Wdate"
                       onfocus="WdatePicker({skin:'whyGreen',endDate:'%y-%M-%d %H:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                       autocomplete="off" value="${(result.entityObj.carInsuranceEnd)}" placeholder="失效日期"
                       id="carInsuranceEnd" name="carInsuranceEnd">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>经办人</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" readonly="true" autocomplete="off" placeholder="经办人"
                       value="${(result.entityObj.user.userName)}" id="userName" name="userName">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>经办手机</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" readonly="true" autocomplete="off" placeholder="经办手机"
                       value="${(result.entityObj.user.phone)}" id="phone" name="phone">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">备注：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea id="remark" name="remark" cols="" rows="" class="textarea"
                          placeholder="${(result.entityObj.remark)}" dragonfly="true"
                          onKeyUp="textarealength(this,100)"></textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
            </div>
        </div>

		<div hidden="hidden" class="row cl">
			<label class="form-label col-xs-4 col-sm-3">ID：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" autocomplete="off" placeholder="ID"
					   value="${(result.entityObj.insuranceId)}" id="insuranceId" name="insuranceId">
			</div>
		</div>


        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input onclick="submitddd()" class="btn btn-primary radius" type="button"
                       value="&nbsp;&nbsp;提交&nbsp;&nbsp;"/>
            </div>
        </div>
    </form>
</article>

<!--_footer 作为公共模版分离出去-->
<#include "include/_footer.html">
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    var t1 = "${(result.entityObj.remark)}";
    console.log(t1);
    $("#remark").val(t1);

    var closec = function () {
        var thisName = parent.layer.getFrameIndex(window.name);
        parent.layer.close(thisName);
    }

    var submitddd = function () {
        let mustData = ['carIdCard', 'company', 'companyPhone', 'code', 'codeContent', 'money', 'carInsuranceStart', 'carInsuranceEnd', 'userName', 'phone'];
        let mustDataTip = ['车牌号不能为空', '保险公司不能为空', '出险电话不能为空', '保险编号不能为空', '保险内容不能为空', '保险费用不能为空', '生效日期不能为空', '失效日期不能为空', '经办人不能为空', '经办手机不能为空']
        let canSet = true;
        console.log(this.form);
        for (let i = 0; i < mustData.length; i++) {
            if ($("#" + mustData[i]).val() == '') {
                layer.msg("必填:" + mustDataTip[i], {icon: 5});
                canSet = false;
                break;
            }
        };
        if (canSet) {
            $.ajax({
                type: "POST",
                url: "/updateInsurance",
                data: $("#form-insurance-edit").serialize(),
                dataType: "json",
                success: function (result) {
                    if (result.flag == 1) {
                        layer.msg(result.flag + ":" + result.msg, {icon: 6});
                    } else {
                        layer.msg(result.flag + ":" + result.msg, {icon: 5});
                    }
                    closec();
                }
            });
        }
    }
</script>

<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
